<div class="p-20">

  <!-- 验收详情  begin -->
  <p-panel headerClass="bg-none " contentClass="p-0" styleClass="radius-none">
    <p-header>
      <div class="text-right p-6-0" style="height: 48px;">
        <span class="border-l-1a8fe8 p-l-8 pull-left m-t-8 m-b-10">
              {{check.name}}
              <span class="panel-status-success">{{storage.dicFilter('checkstatus', check.status)}}</span>
          </span>
        <button pButton type="button" (click)="punishments(check.status);" label="发起处罚" class="btn-secondary"></button>
      </div>
    </p-header>
    <div class="p-20 border-b-d9d9d9">
      <form #form="ngForm" novalidate class="form-horizontal" role="form">
        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128 v-top">基础信息：</div>
          <div class="table-cell width-800">
            <p-doubleTable [titleWidth]="140" [style]="{width:'800px'}" [value]="check" [rowClos]="checkCol">
            </p-doubleTable>
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128 v-top">施工标准：</div>
          <div class="table-cell width-800">
            <p-dataTable #dt [value]="standard" [marginHeight]="20"  [lazy]="true" [headerCheckboxToggleAllPages]="true">
              <p-column *ngFor="let col of standardCol" [field]='col.field' [header]='col.header' [hidden]="col.hidden" [style]="{'width':col.width}">
                <ng-template let-index="rowIndex" let-data="rowData" pTemplate="body" *ngIf="col.tem">
                  <div *ngIf="col.field === 'sortNum'">
                    {{index+1}}
                  </div>
                </ng-template>
              </p-column>
            </p-dataTable>
          </div>
        </div>

      </form>
    </div>
  </p-panel>
  <!-- 验收项  begin -->

  <!-- 整改项目  begin -->
  <p-panel headerClass="bg-none " contentClass="p-0" styleClass="m-t-20 radius-none" *ngFor="let checkDetail of checkList">
    <p-header>
      <div class="text-right p-6-0">
        <span class="border-l-1a8fe8 p-l-8 pull-left m-t-8 m-b-10">
              {{checkDetail.sortNum}}、{{checkDetail.checkStandard}}
              <span class="panel-status-success" *ngIf="checkDetail.result">{{storage.dicFilter('checkstandardresult', checkDetail.result)}}</span>
          </span>
        <button pButton type="button" (click)="openDialog(checkDetail.id,check.status)" label="发起整改" class="btn-secondary"></button>
      </div>
    </p-header>
    <div class="p-20 border-b-d9d9d9">
      <form #form="ngForm" novalidate class="form-horizontal" role="form">
        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">检查项目：</div>
          <div class="table-cell">
            {{checkDetail.checkItem}}
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">配备工具：</div>
          <div class="table-cell">
            {{checkDetail.toolConfig}}
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">拍摄要求：</div>
          <div class="table-cell">
            {{checkDetail.tackPhoneRequire}}
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">照片张数：</div>
          <div class="table-cell">
            {{checkDetail.phoneRequire}}
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">是否为必过项：</div>
          <div class="table-cell">
            {{checkDetail.isRequestPassItem ? '是':'否'}}
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128" style="vertical-align:top">拍摄照片：</div>
          <div class="table-cell">
            <div class="pull-left load-img" *ngIf="checkDetail.photoArr&&checkDetail.photoArr.length>0">
              <p-lightboxfile styleClass="inline-block" [images]="checkDetail.photoArr" [showDelete]="false"></p-lightboxfile>
            </div>
          </div>
        </div>

        <div class="table-row">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128">说明：</div>
          <div class="table-cell">
            {{checkDetail.description}}
          </div>
        </div>

        <div class="table-row" *ngIf="checkDetail.modify&&checkDetail.modify.length>0">
          <div class="table-cell text-right p-l-25 color-b1b1b1 width-128 v-top">整改记录：</div>
          <div class="table-cell">
            <p-dataTable [value]="checkDetail.modify" [showTableHeader]="true">
              <p-column field="sortNum" header="序号" [style]="{'width':'80px'}">
                <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
                  {{ri+1}}
                </ng-template>
              </p-column>
              <p-column field="modifyRecord" header="整改项" [style]="{'width':'150px'}">
                <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
                  <div style="color:#1a91eb;cursor:pointer;">
                    <!-- (click)="info('1')" -->
                    <a class="color-1a91eb" [title]="car[col.field]" target="_blank" [routerLink]="['/saas/engineer/constructionprocess/constructionmanage/modifyrecord', car.id,businessId]">
                      {{car[col.field]}}
                    </a>
                  </div>
                </ng-template>
              </p-column>
              <p-column field="deadlineText" header="最后期限" [style]="{'width':'90px'}"></p-column>
              <p-column field="isCustomScan" header="客户是否可见" [style]="{'width':'100px'}">
                <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
                  {{car[col.field] ? '客户可见' : '客户不可见'}}
                </ng-template>
              </p-column>
              <p-column field="modify" header="整改人" [style]="{'width':'100px'}"></p-column>
              <p-column field="status" header="状态" [style]="{'width':'80px'}">
                <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
                  {{storage.dicFilter('modifystatus', car[col.field])}}
                </ng-template>
              </p-column>
              <p-column field="create" header="提交人" [style]="{'width':'100px'}"></p-column>
              <p-column field="dateCreatedText" header="提交时间" [style]="{'width':'120px'}"></p-column>
            </p-dataTable>
          </div>
        </div>
      </form>
    </div>
  </p-panel>
  <!-- 整改项目  begin -->
  <!-- 操作记录 begin-->
  <p-panel headerClass="bg-none " contentClass="p-0" styleClass="m-t-20 radius-none">
    <p-header>
      <div class="text-right p-6-0" style="height: 48px;">
          <span class="border-l-1a8fe8 p-l-8 pull-left m-t-8 m-b-10">
              操作人记录
            </span>
      </div>
    </p-header>
    <div class="p-20 border-b-d9d9d9">
      <p-dataTable [value]="modifyrecord" [showTableHeader]="true">
        <p-column field="sortNum" header="序号" [style]="{'width':'8%'}">
          <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
            {{ri+1}}
          </ng-template>
        </p-column>
        <p-column field="operationContent" header="操作"></p-column>
        <p-column field="afterSubmitStatus" header="提交后状态">
          <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
            {{storage.dicFilter('checkstatus', car[col.field])}}
          </ng-template>
        </p-column>
        <p-column field="submitPerson" header="提交人"></p-column>
        <p-column field="submitPersonMobile" header="手机号"></p-column>
        <p-column field="submitTimeText" header="提交时间"></p-column>
        <p-column field="isAutoConfirm" header="是否是自动确认">
          <ng-template let-col let-car="rowData" let-ri="rowIndex" pTemplate="body">
            {{car[col.field] ? '是' : '否'}}
          </ng-template>
        </p-column>
      </p-dataTable>
    </div>
  </p-panel>
  <!-- 操作记录 end-->


  <!-- 表单 begin-->
  <p-dialog [header]="'发起整改'" (onHide)="submited=false;photoError=''" [(visible)]="isShow" modal="modal" width="700" [responsive]="true">
    <div class="text-center wrap-content">
      <div class="inline-block" *ngIf="isShow">
        <form #form="ngForm" (ngSubmit)="form.form.valid" novalidate class="form-horizontal" role="form">
          <div class="table-row">
            <div class="table-cell text-right p-l-25 p-required width-128">整改项：</div>
            <div class="table-cell text-left">
              <input type="text" name="modifyRecord" #modifyRecord="ngModel" [(ngModel)]="formObj.modifyRecord" class="p-input width-220"
                (focus)="modifyRecordRight=false" (blur)="modifyRecordRight=true" pInputText required placeholder="请输入整改项"
                maxlength="25" [ngClass]="modifyRecordRight && (modifyRecord.errors?.required&&(modifyRecord.touched || submited))?'p-input-error':'p-input-error-none'">
              <p-message *ngIf="modifyRecordRight" [severity]="'error'" [text]="{'请输入整改项':modifyRecord.errors?.required&&(modifyRecord.touched || submited)}"></p-message>
            </div>
            <div class="table-cell">
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25 width-128">项目名称：</div>
            <div class="table-cell table-text" align="left">
              {{modifyInitData.businessOpportunityName+' '+modifyInitData.businessOpportunityCode}}
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25 width-128 p-required">最后期限：</div>
            <div class="table-cell text-left">
              <p-calendar name="deadline" #deadline="ngModel" [minDate]="deadlineMin" [(ngModel)]="formObj.deadline" styleClass="p-calendar width-220"
                placeholder="请选择最后期限" [inputStyleClass]="'height-full'" required (onFocus)="deadlineRight=false" (onBlur)="deadlineRight=true"></p-calendar>
              <p-message *ngIf="deadlineRight" [severity]="'error'" [text]="{'请选择最后期限':deadline.errors?.required&&(deadline.touched || submited)}"></p-message>
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25 width-128">整改人：</div>
            <div class="table-cell table-text" align="left">
              {{modifyInitData.foremanName+' 项目经理'}}
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25 width-128 p-required">客户是否可见：</div>
            <div class="table-cell text-left">
              <p-dropdown name="isCustomScan" #isCustomScan="ngModel" styleClass="width-220" [options]="isCustomerScan" [(ngModel)]="formObj.isCustomScan"
                [justValue]="true" placeholder="请选择" dataKey="code" optionLabel="name" required></p-dropdown>
              <p-message [severity]="'error'" [text]="{'请选择客户是否可见':isCustomScan.errors?.required&&(isCustomScan.touched || submited)}"></p-message>
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25 p-required width-128 " style="vertical-align:top">
              拍摄图片：
            </div>

            <div class="table-cell text-left " style="width:390px">
              <div class="pull-left load-img" *ngIf="photoImages && photoImages.length>0">
                <p-lightboxfile (removeItem)="removeItem($event,'photo');photoCk()" styleClass="inline-block" [images]="photoImages" [showDelete]="true"></p-lightboxfile>
              </div>
              <div  class="ui-g-12 ui-g-nopad">
                <a (click)="recoverModifyImage();photoCk()" style="color:#1a91eb;text-decoration:underline !important;cursor: pointer;">恢复图片</a>
              </div>
            </div>
          </div>

          <div style="text-align: left;">
            <p-message *ngIf="photoError" styleClass='error-meaage' severity="error" [text]="photoError"></p-message>
          </div>
          <div class="table-row">
            <div class="table-cell text-right p-l-25 p-required width-128  v-top">说明：</div>
            <div class="table-cell text-left relative">
              <textarea rows="5" name='description' (focus)="descriptionRight=false" (blur)="descriptionRight=true" #description="ngModel"
                [(ngModel)]="formObj.description" cols="30" maxlength="50" pInputTextarea placeholder="请输入说明" [ngStyle]="{'width': '220px' }"
                required [ngClass]="descriptionRight && (description.errors?.required&&(description.touched || submited))?'p-input-error':'p-input-error-none'"></textarea>
              <p-message *ngIf="descriptionRight" styleClass="p-centerText" [severity]="'error'" [text]="{'请输入说明':description.errors?.required&&(description.touched || submited)}"></p-message>
              <div class="text-right opacity06" >还可输入{{50 - (formObj.description?.length || 0)}}个字</div>
            </div>
          </div>

          <div class="table-row">
            <div class="table-cell text-right p-l-25"></div>
            <div class="table-cell text-left">
              <button pButton type="button" (click)="photoCk();form.form.valid?submitDialog():submited = true" [label]="'提交'" class="btn btn-success m-btn-dialog"></button>
            </div>
          </div>
        </form>

      </div>
    </div>
  </p-dialog>
  <!-- 表单 end-->

</div>
<!-- 处罚弹窗组件 -->
<app-list-punish-dialog *ngIf="isPunishShow" [data]="punishmentsData" [isShow]="isPunishShow" (changeIsShow)="changePunishShow($event)"></app-list-punish-dialog>
<!-- 处罚弹窗组件end -->
